package com.xishu.controller.us;

import com.xishu.annotation.valid.MethodValidator;
import com.xishu.response.ResponseData;
import com.xishu.service.CommonService;
import com.xishu.service.ShopService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@RestController
@Api(description = "州的查询接口")
public class AddressController {

    @ApiOperation(value = "查询州")
    @GetMapping(value = ("/list/state"), produces = ("application/json;charset=UTF-8"))
    @MethodValidator(mustLogin = false)
    public ResponseData listState() throws Exception {
        List<String> stringList = new ArrayList<>(ShopService.getInstance().getUsState().keySet());
        return CommonService.getInstance().createResponse(stringList);
    }
}
